package com.dc.wifi.main.ui.fragment

import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import com.dc.netlib.base.BaseFragment
import com.dc.wifi.BR
import com.dc.wifi.R
import com.dc.wifi.databinding.FragmentDeviceBinding
import com.dc.wifi.main.adapter.AdapterDevice
import com.dc.wifi.main.adapter.entity.DeviceEntity
import com.dc.wifi.main.model.DeviceViewModel

class DeviceFragment: BaseFragment<DeviceViewModel, FragmentDeviceBinding>(R.layout.fragment_device, BR.mDeviceViewModel) {



    companion object {
        fun createFragment(bundle: Bundle = Bundle()): DeviceFragment {
            return DeviceFragment().apply {
                arguments = bundle
            }
        }
    }
private lateinit var itemList: ArrayList<DeviceEntity>
    override fun initView(savedInstanceState: Bundle?) {
        super.initView(savedInstanceState)
        itemList=ArrayList<DeviceEntity>()
        itemList.add(DeviceEntity("Item 1", false, 1))
        itemList.add(DeviceEntity("Item 2", false, 1)  )
        itemList.add(DeviceEntity("Item 3", false, 1))
        itemList.add(DeviceEntity("Item 4", false, 1))
        itemList.add(DeviceEntity("Item 5", false, 1))
        itemList.add(DeviceEntity("Item 1", false, 1))
        itemList.add(DeviceEntity("Item 1", false, 1))
        itemList.add(DeviceEntity("Item 1", false, 1))
        itemList.add(DeviceEntity("Item 1", false, 1))
        itemList.add(DeviceEntity("Item 1", false, 1))
        itemList.add(DeviceEntity("Item 1", false, 1))
        itemList.add(DeviceEntity("Item 1", false, 1))
        itemList.add(DeviceEntity("Item 1", false, 1))
        val adapterDevice = AdapterDevice(itemList)
        binding.rev.setLayoutManager(LinearLayoutManager(context))
        binding.rev.adapter=adapterDevice
    }
}